
export {myRequest,myRequest2}

const BASE_URL = "https://api-hmugo-web.itheima.net/api/public/v1"
const BASE_URL2="http://152.136.185.210:7878/api/hy66"


const myRequest =(options)=>{
	return new Promise((resolve,reject)=>{
		uni.request({
			url:BASE_URL+options.url,
			method:options.method||'GET',
			data:options.data||{},
			success:(res)=>{
				if(res.statusCode !==200){	
					return uni.showToast({
						title:'获取数据失败'
					})
				}
				resolve(res)
				
			},
			fail:(err)=>{
				uni.showToast({
					title:'请求接口失败'
				})
				reject(err)
			}
		})
		
	})
		
	}
	
	const myRequest2 = options =>{
		return new Promise((resolve,reject)=>{
			uni.request({
				url:BASE_URL2 + options.url,
				method:options.method||'GET',				data:options.data,
				success:res =>{
					resolve(res)
				}
			})
			
		})
	}
